package beans.autowire;

import beans.factory.User;
import cn.stimd.spring.beans.factory.BeanFactory;
import cn.stimd.spring.beans.factory.ObjectProvider;
import cn.stimd.spring.beans.factory.annotation.Autowired;
import cn.stimd.spring.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;

import java.util.Map;
import java.util.Set;

/**
 * Created by Stimd
 * 项目地址：https://gitee.com/stimd/spring-wheel
 * 公众号：Java编程探微
 */
public class AutowireConfig {
    private String name;
    @Value("${spring.profiles.active}")
    private String profile;
    private Set<User> userList;
    @Autowired
    private Map<String, User> userMap;
    @Autowired(required = false)
    private BeanFactory beanFactory;
    @Autowired(required = false)
    private Environment environment;
    private ObjectProvider<LazyBean> lazyBean;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getProfile() {
        return profile;
    }

    public Set<User> getUserList() {
        return userList;
    }

    @Autowired
    public void setUserList(Set<User> userList) {
        this.userList = userList;
    }

    public Map<String, User> getUserMap() {
        return userMap;
    }

    public BeanFactory getBeanFactory() {
        return beanFactory;
    }

    public Environment getEnvironment() {
        return environment;
    }

    public ObjectProvider<LazyBean> getLazyBean() {
        return lazyBean;
    }

    @Autowired
    public void setLazyBean(ObjectProvider<LazyBean> lazyBean) {
        this.lazyBean = lazyBean;
    }
}
